package com.devframe.srtp;


import org.apache.commons.lang3.StringUtils;


/**
 * 
 * @author 詹保山
 *	账户信息
 */
public class Account {

	/**
	 * 用户名称
	 */
	private String userName;
	/**
	 * 密码
	 */
	private String pwd;
	/**
	 * 文件存放的根路径
	 */
	private String rootPath;
	/**
	 * 文件存放层级
	 */
	private int level;
	/**
	 * 缩略图高度
	 */
	private int thumbHeight=20;
	/**
	 * 缩略图宽度
	 */
	private int thumbWidth=20;
	
	public Account(){
		
	}
	
	
	public Account(String userName, String pwd, String rootPath, int level) {
		super();
		this.userName = userName;
		this.pwd = pwd;
		this.rootPath = rootPath;
		
		if(!this.rootPath.endsWith(SRTPConstants.BACKSLASH)){
			this.rootPath=this.rootPath+SRTPConstants.BACKSLASH;
		}
		this.level = level;
	}


	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getPwd() {
		return pwd;
	}
	public void setPwd(String pwd) {
		this.pwd = pwd;
	}
	public String getRootPath() {
		return rootPath;
	}
	public void setRootPath(String rootPath) {
		this.rootPath = rootPath;
		if(!this.rootPath.endsWith(SRTPConstants.BACKSLASH)){
			this.rootPath=this.rootPath+SRTPConstants.BACKSLASH;
		}
	}
	public String toString() {
		return "UserName【"+userName+"】Pwd【"+pwd+"】rootPath【"+rootPath+"】level【"+level+"】";
	}
	public int getLevel() {
		return level;
	}
	public void setLevel(int level) {
		this.level = level;
	}
	
	public boolean auth(String pwd){
		return (StringUtils.equals(this.pwd, pwd));
	}


	public int getThumbHeight() {
		return thumbHeight;
	}


	public void setThumbHeight(int thumbHeight) {
		this.thumbHeight = thumbHeight;
	}


	public int getThumbWidth() {
		return thumbWidth;
	}


	public void setThumbWidth(int thumbWidth) {
		this.thumbWidth = thumbWidth;
	}
	
}
